<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <?php 
      //取出如下若干个文件中的图片文件
      $files = ['abc.gif','ab.v2.3.txt','dir1.PNG','file.jpg','abc.doc'];
      $len = count($files);
      for($i = 0;$i<$len;$i++){
        //   echo "<br>".$files[$i];
          $houzui = strrchr($files[$i],'.');
          $houzui = substr($houzui,1);
          $houzui = strtolower($houzui);
        //   echo "<br>".$houzui;
          if($houzui == 'jpg'||$houzui == 'gif'||$houzui =="png"){
              echo "<br>".$files[$i];
          }
      }

    ?>
</body>
</html>